{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48ea9d2c",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import pandas as pd\n",
    "A0528 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210528_20210603_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0528 = A0528.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0604 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210604_20210609_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0604 = A0604.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0603 = pd.concat([A0528,A0604])\n",
    "A0603_part = A0603.sort_values('TimeStamp')\n",
    "A0603_part.shape[0]\n",
    "#A0603.head()\n",
    "A0528['TimeStamp'] = A0528['TimeStamp'].astype(str)\n",
    "A0603_day = A0528[A0528['TimeStamp'].str.contains('2021-06-03')]\n",
    "A603 = pd.concat([A0603_day,A0604])\n",
    "A603['上行利用率PUSCH','下行利用率PDSCH','下行利用率PDCCH','有效RRC连接平均数','上行流量','下行流量'].fillna(0, inplace=True)\n",
    "A0603_Part = A0603.sort_values('TimeStamp')\n",
    "A603.to_csv(\"4G_AFE_0603_0609.csv\")\n",
    "\n",
    "\n",
    "\n",
    "import pandas as pd\n",
    "A0610 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210610-20210610_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0610 = A0610.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0611 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210611_20210616_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0611 = A0611.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A610 = pd.concat([A0610,A0611])\n",
    "A610 = A0610.sort_values('TimeStamp')\n",
    "A610['上行利用率PUSCH','下行利用率PDSCH','下行利用率PDCCH','有效RRC连接平均数','上行流量','下行流量'].fillna(0, inplace=True)\n",
    "A610.to_csv(\"4G_AFE_0610_0616.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3419ff78",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "A0610 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210610-20210610_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0610 = A0610.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0611 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210611_20210616_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0611 = A0611.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A610 = pd.concat([A0610,A0611])\n",
    "A610 = A0610.sort_values('TimeStamp')\n",
    "A610['上行利用率PUSCH','下行利用率PDSCH','下行利用率PDCCH','有效RRC连接平均数','上行流量','下行流量'].fillna(0, inplace=True)\n",
    "A610.to_csv(\"4G_AFE_0610_0616.csv\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "215c90dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "A0617 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210617-20210617_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0617 = A0617.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0618 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210618_20210622_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0618 = A0618.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0623 = pd.read_csv(\"compdata/4G5G_Data/Train_Data/4g_pm_20210623_20210630_AFE97F546A10368F.csv\",encoding='gbk')\n",
    "A0623 = A0623.drop_duplicates(subset=['TimeStamp','UserLabel'])\n",
    "A0617_all = pd.concat([A0617,A0623])\n",
    "A0617_all = A0617_all.sort_values('TimeStamp')\n",
    "A0617['TimeStamp'] = A0617['TimeStamp'].astype(str)\n",
    "A0623_day = A0617[A0617['TimeStamp'].str.contains('2021-06-23')]\n",
    "A617 = pd.concat([A0617,A0618,A0623_day])\n",
    "A617.sort_values('TimeStamp')\n",
    "A617['上行利用率PUSCH','下行利用率PDSCH','下行利用率PDCCH','有效RRC连接平均数','上行流量','下行流量'].fillna(0, inplace=True)\n",
    "A617.to_csv(\"4G_AFE_0617_0623.csv\")\n",
    "A624 = pd.concat([A0623, A0623_day, A0623_day]).drop_duplicates(keep=False)\n",
    "A624.sort_values('TimeStamp')\n",
    "A624['上行利用率PUSCH','下行利用率PDSCH','下行利用率PDCCH','有效RRC连接平均数','上行流量','下行流量'].fillna(0, inplace=True)\n",
    "A624.to_csv(\"4G_AFE_0624_0630.csv\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py37",
   "language": "python",
   "name": "py37"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
